﻿


using GnpFine.Core;
using SqlSugar;
using System.ComponentModel.DataAnnotations.Schema;

namespace Kingdee.API.TGTEST
{

    
    /// <summary>
    /// 入库单
    /// </summary>
    [SugarTable("InstrumentStock", "器械入库单")]
    // 仓储模式用这个自定义的注解，自动切库
    [NmpaTable]
    // 单例模式用这个suger特性切库，仓储模式也可以用，自定义个更简洁
    [TenantAttribute(SqlSugarConst.NmpaConfigId)]
    public class InstrumentStock : EntityBase
    {
        public DateTime PURCHASE_DATE { get; set; } //进货日期
        public string BUY_NO { get; set; } //进货单据号
        public string INSTRUMENT_CODE { get; set; } //厂商药品编码
        public string INSTRUMENT_NAME { get; set; } //厂商药品名称
        public string REGIST_NO { get; set; } //批准文号
        public string BATCH_NO { get; set; } //批号
        public DateTime VALIDITY { get; set; } //有效期至
        public string PRODUCER { get; set; } //生产厂家
        public string SPEC { get; set; } //规格
        public string UNIT { get; set; } //单位

        [Column(TypeName = "decimal(23,10)")]
        public decimal QTY { get; set; } //数量
        public string PROVIDER_NAME { get; set; } //供货单位名称
        public string PROVIDER_CODE { get; set; } //供货单位编码
        public string DESTROY_NO { get; set; } //消毒批号




        /*
        Resharper通过生成"格式化成员"来支持此功能

            https://www.jetbrains.com/resharper/webhelp/Code_Generation__Formatting_Members.html

        Resharper -> Edit -> Generate Code -> Formatting Members
        要么

            alt + insert -> Formatting Members



        使用反射，您实际上可以编写ToString（）方法：

        public override String ToString()
        {
            Type objType = this.GetType();
            PropertyInfo[] propertyInfoList = objType.GetProperties();
            StringBuilder result = new StringBuilder();
            foreach (PropertyInfo propertyInfo in propertyInfoList)
                result.AppendFormat("{0}={1} ", propertyInfo.Name, propertyInfo.GetValue(this));

            return result.ToString();
        }
        */

        public override string ToString()
        {
            return $"{nameof(PURCHASE_DATE)}: {PURCHASE_DATE}, {nameof(BUY_NO)}: {BUY_NO}, {nameof(INSTRUMENT_CODE)}: {INSTRUMENT_CODE}, {nameof(INSTRUMENT_NAME)}: {INSTRUMENT_NAME}, {nameof(REGIST_NO)}: {REGIST_NO}, {nameof(BATCH_NO)}: {BATCH_NO}, {nameof(VALIDITY)}: {VALIDITY}, {nameof(PRODUCER)}: {PRODUCER}, {nameof(SPEC)}: {SPEC}, {nameof(UNIT)}: {UNIT}, {nameof(QTY)}: {QTY}, {nameof(PROVIDER_NAME)}: {PROVIDER_NAME}, {nameof(PROVIDER_CODE)}: {PROVIDER_CODE}, {nameof(DESTROY_NO)}: {DESTROY_NO}";
        }
    }


    /// <summary>
    /// 出库单
    /// </summary>
    [SugarTable("InstrumentSale", "器械出库单")]
    [NmpaTable]
    [TenantAttribute(SqlSugarConst.NmpaConfigId)]
    public class InstrumentSale : EntityBase
    {
        public string SALE_NO { get; set; }//销售单据号
        public DateTime SALE_DATE { get; set; }//销售日期
        public string INSTRUMENT_CODE { get; set; }//厂商药品编码
        public string INSTRUMENT_NAME { get; set; }//厂商药品名称
        public string REGIST_NO { get; set; }//批准文号
        public string BATCH_NO { get; set; }//批号
        public DateTime VALIDITY { get; set; }//有效期至
        public string PRODUCER { get; set; }//生产厂家
        public string SPEC { get; set; }//规格
        public string UNIT { get; set; }//单位

        [Column(TypeName = "decimal(23,10)")]
        public decimal QTY { get; set; }//数量
        public string PURCHASER_NAME { get; set; }//购货单位名称
        public string PURCHASER_CODE { get; set; }//购货单位编码
        public string DESTROY_NO { get; set; } //消毒批号

        public override string ToString()
        {
            return $"{nameof(SALE_NO)}: {SALE_NO}, {nameof(SALE_DATE)}: {SALE_DATE}, {nameof(INSTRUMENT_CODE)}: {INSTRUMENT_CODE}, {nameof(INSTRUMENT_NAME)}: {INSTRUMENT_NAME}, {nameof(REGIST_NO)}: {REGIST_NO}, {nameof(BATCH_NO)}: {BATCH_NO}, {nameof(VALIDITY)}: {VALIDITY}, {nameof(PRODUCER)}: {PRODUCER}, {nameof(SPEC)}: {SPEC}, {nameof(UNIT)}: {UNIT}, {nameof(QTY)}: {QTY}, {nameof(PURCHASER_NAME)}: {PURCHASER_NAME}, {nameof(PURCHASER_CODE)}: {PURCHASER_CODE}, {nameof(DESTROY_NO)}: {DESTROY_NO}";
        }
    }

    /// <summary>
    /// 即时库存
    /// </summary>
    [SugarTable("InstrumentStore","器械即时库存")]
    [NmpaTable]
    [TenantAttribute(SqlSugarConst.NmpaConfigId)]
    public class InstrumentStore : EntityBase
    {
        public string INSTRUMENT_CODE { get; set; }//厂商药品编码
        public string INSTRUMENT_NAME { get; set; }//厂商药品名称
        public string REGIST_NO { get; set; }//批准文号
        public string BATCH_NO { get; set; }//批号
        public DateTime VALIDITY { get; set; }//有效期至
        public string PRODUCER { get; set; }//生产厂家
        public string SPEC { get; set; }//规格
        public string UNIT { get; set; }//单位

        [Column(TypeName = "decimal(23,10)")]
        public decimal QTY { get; set; }//数量
        public string DESTROY_NO { get; set; } //消毒批号

        public override string ToString()
        {
            return $"{nameof(INSTRUMENT_CODE)}: {INSTRUMENT_CODE}, {nameof(INSTRUMENT_NAME)}: {INSTRUMENT_NAME}, {nameof(REGIST_NO)}: {REGIST_NO}, {nameof(BATCH_NO)}: {BATCH_NO}, {nameof(VALIDITY)}: {VALIDITY}, {nameof(PRODUCER)}: {PRODUCER}, {nameof(SPEC)}: {SPEC}, {nameof(UNIT)}: {UNIT}, {nameof(QTY)}: {QTY}, {nameof(DESTROY_NO)}: {DESTROY_NO}";
        }
    }
}
